<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>

  <body>
    <script>
      console.log(1);
      setTimeout(function () {
        console.log(2);
      }, 0);
      setTimeout(function () {
        // 去排队
        setTimeout(function () {
          console.log(123);
        }, 100);
        // 先输出3
        console.log(3);
      }, 0);
      console.log(4);
      setTimeout(function () {
        console.log(5);
      }, 1000);
      console.log(6);
      setTimeout(function () {
        console.log(7);
      }, 500);
      console.log(8);
      setTimeout(function () {
        console.log(9);
      }, 100);
      setTimeout(function () {
        console.log(10);
      }, 1000);
      console.log(11);
      ////1 4 6 8 11 2 3 9 123 7 5 10
    </script>
  </body>
</html>
